/*
 * Copyright (C) 2020 Kandao Technology Co.,Ltd.
 *
 * This software is the property of Kandao Technology Co.,Ltd.
 * Use or redistribution of this software without written permission
 * from Kandao Technology Co.,Ltd is prohibited.
 *
 * @project  Kandao OS
 * @version  1.0
 * @author   Xing Dongfeng
 * @created  Fri Jul 28 2020
 */
#pragma once

#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */

/*------------------------------------------include-------------------------------------------------------*/

/*------------------------------------------Macro--------------------------------------------------------*/
/*
NOTE: You must specify the current module name ('module') before using it. eg:
    static const char *module = "log";
*/
#define KDLOG_DECLARE_MODULE_NAME(tag) static const char *module = #tag;

#include <android/log.h>
#define LOGV(format, ...) __android_log_print(ANDROID_LOG_VERBOSE,"ffmpeg-lib",format,##__VA_ARGS__)
#define LOGD(format, ...) __android_log_print(ANDROID_LOG_DEBUG,"ffmpeg-lib",format,##__VA_ARGS__)
#define LOGI(format, ...) __android_log_print(ANDROID_LOG_INFO,"ffmpeg-lib",format,##__VA_ARGS__)
#define LOGW(format, ...) __android_log_print(ANDROID_LOG_WARN,"ffmpeg-lib",format,##__VA_ARGS__)
#define LOGE(format, ...) __android_log_print(ANDROID_LOG_ERROR,"ffmpeg-lib",format,##__VA_ARGS__)
#define printf(format, ...) __android_log_print(ANDROID_LOG_VERBOSE,"ffmpeg-lib",format,##__VA_ARGS__)

/*------------------------------------------Func--------------------------------------------------------*/
/**
 * @brief Disable specifying module
 *
 * @param module
 */
void kdlog_enable_printf_output(bool enable);

/**
 * @brief callback the output
 *
 * @param callback
 */

void logV(const char* module, const char *function, int line, const char* fmt, ...);
void logD(const char* module, const char *function, int line, const char* fmt, ...);
void logI(const char* module, const char *function, int line, const char* fmt, ...);
void logW(const char* module, const char *function, int line, const char* fmt, ...);
void logE(const char* module, const char *function, int line, const char* fmt, ...);
void printf_output(const char *module, const char *function, int line, const char *fmt, ...);

/*------------------------------------------end--------------------------------------------------------*/
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
